2020 NYPD cluster sum

NYPD_2020_boro = NYPD_2020 %>% 
  filter(name_of_borough != "") 

leaflet(NYPD_2020_boro) %>% 
  addProviderTiles(providers$CartoDB.Positron) %>% 
  setView(lng = -73.935242, lat = 40.730610, zoom = 10) %>% 
  addMarkers(clusterOptions = markerClusterOptions())

2020 NYPD map for five boroughs

NYPD_2020  %>% 
  filter(name_of_borough != "") %>% 
  mutate(text_label = str_c("borough:", name_of_borough)) %>% 
  plot_ly()  %>% 
    add_markers(
    y = ~ latitude,
    x = ~ longitude,
    text = ~ text_label,
    alpha = 0.02,
    frame = ~ month,
    mode = "marker",
    color = ~ name_of_borough,
  ) %>%
  animation_opts(transition = 1,frame = 12)

2020 NYPD day count

plot = 
  NYPD_2020_day_count %>% 
  ggplot(aes(x = date, y = count)) +
  geom_line(col = "deepskyblue3", size = 1) + 
  geom_point(col = "deepskyblue3", size = 2) + 
  labs(title = "Estimated NPYD Count Per Day in 2020",
       subtitle = "1/1/2020 - 12/31/2020.",
       x = "day", 
       y = "Estimated NPYD Xount Per Day") +
  theme(axis.text.x = element_text(angle = 45)) +
  transition_reveal(date) 

plot

Heatmap for 2020 NYPD

NYPD_2020_weekdays %>%
  plot_ly(
    x = ~hour, y = ~dow, z = ~count, type = "heatmap", colors = "BuPu"
  ) %>%
  colorbar(title = "2020", x = 1, y = 1)